<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>财务中心</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
        }
    </style>
</head>
<body class="bg-gray-100">
    <div class="mx-auto max-w-[393px] h-[852px] bg-white relative overflow-hidden rounded-[40px] shadow-2xl">
        <!-- Status Bar -->
        <div class="bg-white px-6 pt-3 pb-2">
            <div class="flex justify-between items-center text-xs">
                <span class="font-semibold">9:41</span>
                <div class="flex space-x-1">
                    <i class="fas fa-signal"></i>
                    <i class="fas fa-wifi"></i>
                    <i class="fas fa-battery-full"></i>
                </div>
            </div>
        </div>

        <!-- Header -->
        <div class="bg-gradient-to-r from-pink-500 to-rose-500 px-4 py-3">
            <div class="flex items-center justify-between text-white">
                <a href="home-b2c.html" class="text-white">
                    <i class="fas fa-arrow-left text-lg"></i>
                </a>
                <h1 class="text-lg font-semibold">财务中心</h1>
                <i class="fas fa-download text-lg"></i>
            </div>
        </div>

        <!-- Balance Card -->
        <div class="px-4 py-3 bg-gradient-to-r from-pink-500 to-rose-500">
            <div class="bg-white/10 backdrop-blur-sm rounded-xl p-4">
                <div class="text-white">
                    <p class="text-sm opacity-80 mb-2">账户余额</p>
                    <p class="text-3xl font-bold mb-4">¥168,526.80</p>
                    <div class="grid grid-cols-3 gap-3">
                        <div class="text-center">
                            <p class="text-xs opacity-80">待结算</p>
                            <p class="text-lg font-semibold">¥12,580</p>
                        </div>
                        <div class="text-center">
                            <p class="text-xs opacity-80">可提现</p>
                            <p class="text-lg font-semibold">¥155,946</p>
                        </div>
                        <div class="text-center">
                            <p class="text-xs opacity-80">冻结中</p>
                            <p class="text-lg font-semibold">¥0</p>
                        </div>
                    </div>
                </div>
                <div class="flex space-x-2 mt-4">
                    <button onclick="openWithdraw()" class="flex-1 bg-white text-pink-600 font-medium text-sm py-2.5 rounded-lg shadow-sm hover:bg-pink-50 transition-colors border border-white/50">
                        <i class="fas fa-money-check-alt mr-1"></i>提现
                    </button>
                    <button onclick="openBill()" class="flex-1 bg-white/20 text-white font-medium text-sm py-2.5 rounded-lg hover:bg-white/30 transition-colors">
                        <i class="fas fa-file-invoice mr-1"></i>账单
                    </button>
                </div>
            </div>
        </div>

        <!-- Scrollable Content -->
        <div class="h-[calc(852px-240px)] overflow-y-auto pb-44">
            <!-- Quick Stats -->
            <div class="p-4">
                <h3 class="font-semibold mb-3 flex items-center">
                    <span class="w-1 h-4 bg-pink-600 mr-2 rounded-full"></span>
                    本月财务概览
                </h3>
                <div class="grid grid-cols-2 gap-3">
                    <div class="bg-green-50 rounded-lg p-3 border border-green-200">
                        <i class="fas fa-arrow-down text-green-600 text-lg mb-2"></i>
                        <p class="text-xs text-gray-600">收入</p>
                        <p class="text-xl font-bold text-gray-800">¥286,580</p>
                        <p class="text-xs text-green-600 mt-1">
                            <i class="fas fa-arrow-up text-xs mr-1"></i>+12.5%
                        </p>
                    </div>
                    <div class="bg-red-50 rounded-lg p-3 border border-red-200">
                        <i class="fas fa-arrow-up text-red-600 text-lg mb-2"></i>
                        <p class="text-xs text-gray-600">支出</p>
                        <p class="text-xl font-bold text-gray-800">¥45,320</p>
                        <p class="text-xs text-red-600 mt-1">
                            <i class="fas fa-arrow-up text-xs mr-1"></i>+5.2%
                        </p>
                    </div>
                    <div class="bg-blue-50 rounded-lg p-3 border border-blue-200">
                        <i class="fas fa-percentage text-blue-600 text-lg mb-2"></i>
                        <p class="text-xs text-gray-600">平台佣金</p>
                        <p class="text-xl font-bold text-gray-800">¥8,597</p>
                        <p class="text-xs text-gray-500 mt-1">费率: 3%</p>
                    </div>
                    <div class="bg-purple-50 rounded-lg p-3 border border-purple-200">
                        <i class="fas fa-chart-line text-purple-600 text-lg mb-2"></i>
                        <p class="text-xs text-gray-600">净利润</p>
                        <p class="text-xl font-bold text-gray-800">¥232,663</p>
                        <p class="text-xs text-green-600 mt-1">
                            <i class="fas fa-arrow-up text-xs mr-1"></i>+15.8%
                        </p>
                    </div>
                </div>
            </div>

            <!-- Financial Tools -->
            <div class="p-4">
                <h3 class="font-semibold mb-3 flex items-center">
                    <span class="w-1 h-4 bg-pink-600 mr-2 rounded-full"></span>
                    财务工具
                </h3>
                <div class="grid grid-cols-3 gap-3">
                    <div class="text-center cursor-pointer" onclick="openInvoice()">
                        <div class="w-14 h-14 mx-auto bg-gradient-to-br from-blue-500 to-blue-600 rounded-xl flex items-center justify-center text-white mb-2 shadow-lg hover:shadow-xl transition-all">
                            <i class="fas fa-file-invoice-dollar text-xl"></i>
                        </div>
                        <p class="text-xs text-gray-700">发票管理</p>
                    </div>
                    <div class="text-center cursor-pointer" onclick="openDeposit()">
                        <div class="w-14 h-14 mx-auto bg-gradient-to-br from-green-500 to-green-600 rounded-xl flex items-center justify-center text-white mb-2 shadow-lg hover:shadow-xl transition-all">
                            <i class="fas fa-hand-holding-usd text-xl"></i>
                        </div>
                        <p class="text-xs text-gray-700">保证金</p>
                    </div>
                    <div class="text-center cursor-pointer" onclick="openCalculator()">
                        <div class="w-14 h-14 mx-auto bg-gradient-to-br from-purple-500 to-purple-600 rounded-xl flex items-center justify-center text-white mb-2 shadow-lg hover:shadow-xl transition-all">
                            <i class="fas fa-calculator text-xl"></i>
                        </div>
                        <p class="text-xs text-gray-700">费用计算</p>
                    </div>
                    <div class="text-center cursor-pointer" onclick="openBankAccount()">
                        <div class="w-14 h-14 mx-auto bg-gradient-to-br from-orange-500 to-orange-600 rounded-xl flex items-center justify-center text-white mb-2 shadow-lg hover:shadow-xl transition-all">
                            <i class="fas fa-university text-xl"></i>
                        </div>
                        <p class="text-xs text-gray-700">银行账户</p>
                    </div>
                    <div class="text-center cursor-pointer" onclick="openStatement()">
                        <div class="w-14 h-14 mx-auto bg-gradient-to-br from-pink-500 to-pink-600 rounded-xl flex items-center justify-center text-white mb-2 shadow-lg hover:shadow-xl transition-all">
                            <i class="fas fa-receipt text-xl"></i>
                        </div>
                        <p class="text-xs text-gray-700">对账单</p>
                    </div>
                    <div class="text-center cursor-pointer" onclick="openFinancialReport()">
                        <div class="w-14 h-14 mx-auto bg-gradient-to-br from-indigo-500 to-indigo-600 rounded-xl flex items-center justify-center text-white mb-2 shadow-lg hover:shadow-xl transition-all">
                            <i class="fas fa-chart-pie text-xl"></i>
                        </div>
                        <p class="text-xs text-gray-700">财务报表</p>
                    </div>
                </div>
            </div>

            <!-- Recent Transactions -->
            <div class="p-4">
                <h3 class="font-semibold mb-3 flex items-center justify-between">
                    <span class="flex items-center">
                        <span class="w-1 h-4 bg-pink-600 mr-2 rounded-full"></span>
                        最近交易
                    </span>
                    <span onclick="viewAllTransactions()" class="text-xs text-pink-600 cursor-pointer hover:text-pink-700">查看全部 <i class="fas fa-chevron-right text-xs"></i></span>
                </h3>
                <div class="space-y-3">
                    <!-- Transaction 1 -->
                    <div class="bg-white rounded-lg border border-gray-200 p-3">
                        <div class="flex items-center justify-between mb-2">
                            <div class="flex items-center">
                                <div class="w-8 h-8 bg-green-100 rounded-full flex items-center justify-center mr-3">
                                    <i class="fas fa-arrow-down text-green-600 text-sm"></i>
                                </div>
                                <div>
                                    <p class="text-sm font-medium">订单收入</p>
                                    <p class="text-xs text-gray-500">订单号: 202501050156</p>
                                </div>
                            </div>
                            <div class="text-right">
                                <p class="text-sm font-bold text-green-600">+¥1,298</p>
                                <p class="text-xs text-gray-400">10:32</p>
                            </div>
                        </div>
                    </div>

                    <!-- Transaction 2 -->
                    <div class="bg-white rounded-lg border border-gray-200 p-3">
                        <div class="flex items-center justify-between mb-2">
                            <div class="flex items-center">
                                <div class="w-8 h-8 bg-red-100 rounded-full flex items-center justify-center mr-3">
                                    <i class="fas fa-arrow-up text-red-600 text-sm"></i>
                                </div>
                                <div>
                                    <p class="text-sm font-medium">平台佣金</p>
                                    <p class="text-xs text-gray-500">费率: 3%</p>
                                </div>
                            </div>
                            <div class="text-right">
                                <p class="text-sm font-bold text-red-600">-¥38.94</p>
                                <p class="text-xs text-gray-400">10:32</p>
                            </div>
                        </div>
                    </div>

                    <!-- Transaction 3 -->
                    <div class="bg-white rounded-lg border border-gray-200 p-3">
                        <div class="flex items-center justify-between mb-2">
                            <div class="flex items-center">
                                <div class="w-8 h-8 bg-green-100 rounded-full flex items-center justify-center mr-3">
                                    <i class="fas fa-arrow-down text-green-600 text-sm"></i>
                                </div>
                                <div>
                                    <p class="text-sm font-medium">订单收入</p>
                                    <p class="text-xs text-gray-500">订单号: 202501050155</p>
                                </div>
                            </div>
                            <div class="text-right">
                                <p class="text-sm font-bold text-green-600">+¥598</p>
                                <p class="text-xs text-gray-400">09:45</p>
                            </div>
                        </div>
                    </div>

                    <!-- Transaction 4 -->
                    <div class="bg-white rounded-lg border border-gray-200 p-3">
                        <div class="flex items-center justify-between mb-2">
                            <div class="flex items-center">
                                <div class="w-8 h-8 bg-blue-100 rounded-full flex items-center justify-center mr-3">
                                    <i class="fas fa-money-check-alt text-blue-600 text-sm"></i>
                                </div>
                                <div>
                                    <p class="text-sm font-medium">提现成功</p>
                                    <p class="text-xs text-gray-500">到账: 工商银行尾号8866</p>
                                </div>
                            </div>
                            <div class="text-right">
                                <p class="text-sm font-bold text-blue-600">¥10,000</p>
                                <p class="text-xs text-gray-400">昨天</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Settlement Schedule -->
            <div class="p-4">
                <h3 class="font-semibold mb-3 flex items-center">
                    <span class="w-1 h-4 bg-pink-600 mr-2 rounded-full"></span>
                    结算计划
                </h3>
                <div class="bg-gradient-to-r from-pink-50 to-rose-50 rounded-xl p-4 border border-pink-200">
                    <div class="flex items-center justify-between mb-3">
                        <div>
                            <p class="text-sm font-semibold">下次结算日期</p>
                            <p class="text-xs text-gray-600 mt-1">2025年1月15日</p>
                        </div>
                        <div class="text-right">
                            <p class="text-sm font-semibold">预计到账</p>
                            <p class="text-lg font-bold text-pink-600 mt-1">¥12,580</p>
                        </div>
                    </div>
                    <div class="bg-white rounded-lg p-2 text-center">
                        <p class="text-xs text-gray-500">结算周期: T+7 | 自动结算已开启</p>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        // 财务功能导航
        function openWithdraw() {
            window.location.href = 'b2b-withdraw.html';
        }

        function openBill() {
            window.location.href = 'b2b-bill.html';
        }

        function openInvoice() {
            window.location.href = 'b2b-invoice.html';
        }

        function openDeposit() {
            window.location.href = 'b2b-deposit.html';
        }

        function openCalculator() {
            window.location.href = 'b2b-fee-calculator.html';
        }

        function openBankAccount() {
            window.location.href = 'b2b-bank-account.html';
        }

        function openStatement() {
            window.location.href = 'b2b-statement.html';
        }

        function openFinancialReport() {
            window.location.href = 'b2b-financial-report.html';
        }

        function viewAllTransactions() {
            window.location.href = 'b2b-all-transactions.html';
        }

        // 交易记录点击
        document.addEventListener('DOMContentLoaded', function() {
            // 为所有交易记录添加点击事件
            const transactions = document.querySelectorAll('.bg-white.rounded-lg.border');
            transactions.forEach((transaction, index) => {
                transaction.style.cursor = 'pointer';
                transaction.addEventListener('click', function() {
                    // 根据交易类型传递不同参数
                    let transactionType = 'order-income'; // 默认
                    const transactionText = transaction.querySelector('.text-sm.font-medium').textContent;
                    
                    if (transactionText.includes('平台佣金')) {
                        transactionType = 'commission';
                    } else if (transactionText.includes('提现')) {
                        transactionType = 'withdrawal';
                    }
                    
                    window.location.href = `b2b-transaction-detail.html?type=${transactionType}`;
                });
            });
        });
    </script>
</body>
</html>